package com.zzty.txj.serviceImpl;

import com.zzty.txj.dao.AbilityMapper;

import com.zzty.txj.entity.Ability;
import com.zzty.txj.entity.User;
import com.zzty.txj.service.AbilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AbilityServiceImpl implements AbilityService {

    @Autowired
    AbilityMapper abilityMapper;

    @Override
    public List<Ability> getAbility() {

        List<Ability> abilities = abilityMapper.getAbility();

            return abilities;
    }

    @Override
    public Integer updateAbility(Ability ability) {
        Integer count = abilityMapper.updateAbility(ability);
        if (count == null || count == 0) {
            return null;
        } else {
            return count;
        }
    }

    @Override
    public Integer addAbility(User user) {
        Integer count=abilityMapper.addAbility(user);
        return count;
    }

    @Override
    public Ability getAbilityByUserId(Integer userId) {
        Ability ability=abilityMapper.getAbilityByUserId(userId);
        return ability;
    }
}
